import axios from 'axios'

const axiosinstance = axios.create({
  timeout: 6000
})

type Method = 'get' | 'post' // 元组

export const request = (
  method: Method,
  url: string,
  data?: any
) => {
  if (method === 'post') {
    return axiosinstance.post(url, data)
  } else {
    return axiosinstance.get(url, {
      params: data
    })
  }
}